<?phpnamespace app\util;class Tool{    public function timediff($begin_time,$end_time)    {        if($begin_time < $end_time){            //现在时间  活动时间还没到            $starttime = $begin_time;            $endtime = $end_time;        }else{            //b > e 说明 活动已经结束了            $res = array("day" => 0,"hour" => 0,"min" => 0,"sec" => 0);            return $res;        }        //计算天数        $timediff = $endtime-$starttime;        $days = intval($timediff/86400);        //计算小时数        $remain = $timediff%86400;        $hours = intval($remain/3600);        //计算分钟数        $remain = $remain%3600;        $mins = intval($remain/60);        //计算秒数        $secs = $remain%60;        $res = array("day" => $days,"hour" => $hours,"min" => $mins,"sec" => $secs);        return $res;    }}